<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org"> 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="static/easyui/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css"href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/metisMenu/metisMenu_custom.css" />
<link rel="stylesheet" href="static/css/style.css" />
<script src="static/jquery/jquery-1.12.4.js"></script>
<script src="static/easyui/jquery.easyui.min.js"></script>
<script src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<script src="static/jqueryValidate/jquery.validate.min.js"></script>
<script src="static/jqueryValidate/additional-methods.min.js"></script>
<script src="static/jqueryValidate/localization/messages_zh.min.js"></script>
<script src="static/moment/moment.js"></script>
<script src="static/moment/locale/zh-cn.js"></script>
<title>日计划审核</title>
</head>

<body class="easyui-layout">
	<div data-options="region:'center'">
		<table id="reviewed_table" class="easyui-datagrid" style="height: 50%">
		</table>
		<table id="unreviewed_table" class="easyui-datagrid" style="height: 50%">
		</table>
	</div>
	<div id="pro_tb">
		<div>
			发布日期：<input id="fromDate" class="easyui-datebox" /> ~ <input
				id="toDate" class="easyui-datebox" /> &nbsp;
			<a href="#" class="easyui-linkbutton" iconCls="icon-search" id="search" onclick="">搜索</a>
		</div>
	</div>
	<div id="proDlg" class="easyui-dialog info_dialog"
		style="width: 800px; padding: 10px 20px" closed="true"
		buttons="#pro-dlg-buttons">
		<div class="title"></div>
		<form id="proFm" method="post">
			<div class="content_container">
				<table class="content_table">
					<tr>
						<td style="width: 100px;">项目</td>
						<td><input class="easyui-textbox" data-options="readonly:true" 
						id="projectitem" name="projectitem" style="width: 200px;"/></td>
						<td style="width: 100px;">日期：</td>
						<td><input class="easyui-datebox" data-options="readonly:true" id="plandate" name="plandate" style="width: 200px;"/></td>
					</tr>
					<tr>
						<td style="width: 100px;">内容：</td>
						<td colspan="3"><input class="easyui-textbox"data-options="readonly:true,multiline:true" 
						id="content" name="content" style="width: 550px;height:100px;"/></td>
					</tr>
					<tr>
						<td style="width: 100px;">形象进度：</td>
						<td colspan="3"><input class="easyui-textbox" data-options="readonly:true" id="percent" name="percent" style="width: 200px;"/>
						</td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div id="pro-dlg-buttons">
		<a href="# " class="easyui-linkbutton " iconCls="icon-ok "
			onclick="savePro()">审核</a> <a href="# " class="easyui-linkbutton "
			iconCls="icon-cancel "
			onclick="disable()">拒绝</a>
	</div>
</body>
<script>
	var currentPro;
	var fromDate = ""; 
	var toDate = ""; 
	var projectitemid = [[${projectitemid}]];

	$(document).ready(function() {
		$('#reviewed_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : false,
			striped : true,
			toolbar : '#pro_tb',
			title:"已审核",
			url : "../reviewed/plandaily.do",
			method : 'get',
			onSelect : function(index, row) {
				currentPro = row;
			},
			queryParams : {
				startdate:fromDate,
				todate:toDate,
				projectitemid:projectitemid
			},
			columns : [ [ {
				field : 'title',
				title : '项目',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain.item){
						return row.planMain.item.name;
					}
				}
			}, {
				field : 'planmainname',
				title : '日计划',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain){
						return row.planMain.name;
					}
				}
			}, {
				field : 'planmaincontent',
				title : '日计划内容',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain){
						return row.planMain.content;
					}
				}
			}, {
				field : 'content',
				title : '日计划内容',
				width : ''
			}, {
				field : 'plandate',
				title : '日期',
				width : '',
				formatter : formatDate
			}, {
				field : 'percent',
				title : '形象进度',
				width : '',
				formatter : function(value, row, index) {
					return value+'%';
				}
			},{
				field : 'reason',
				title : '拒绝理由',
				width : ''
			}, {
				field : 'status',
				title : '状态',
				width : '',
				formatter : function(value, row, index) {
					if(value==4){
						return value='已审';
					}else if(value==3){
						return value='已拒绝';
					}else if(value==6){
						return value='待二级审核';
					}else if(value==7){
						return value='待一级审核';
					}
				}
			}] ]
		});
		
		$('#unreviewed_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : true,
			striped : true,
			title:"未审核",
			url : "../review/plandaily.do",
			method : 'get',
			onSelect : function(index, row) {
				currentPro = row;
			},
			queryParams : {
				startdate:fromDate,
				todate:toDate,
				projectitemid:projectitemid
			},
			columns : [ [ {
				field : 'title',
				title : '项目',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain.item){
						return row.planMain.item.name;
					}
				}
			}, {
				field : 'planmainname',
				title : '日计划',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain){
						return row.planMain.name;
					}
				}
			}, {
				field : 'planmaincontent',
				title : '日计划内容',
				width : '',
				formatter : function(value,row,index){
					if(row.planMain){
						return row.planMain.content;
					}
				}
			}, {
				field : 'content',
				title : '日计划内容',
				width : '400px'
			}, {
				field : 'plandate',
				title : '日期',
				width : '100px',
				formatter : formatDate
			}, {
				field : 'percent',
				title : '形象进度',
				width : '',
				formatter : function(value, row, index) {
					return value+'%';
				}
			}, {
				field : 'handle',
				title : '操作',
				width : '100px',
				formatter : function(value, row, index) {
					return '<a style="color:blue" href="#" onclick="updatepro('+index+')">审核</a>'	
				}
			}] ]
		});
	});

	function refreshProTable() {
		$('#reviewed_table').datagrid("load",{
			startdate:fromDate,
			enddate:toDate,
			projectitemid:projectitemid
		});
		
		$('#unreviewed_table').datagrid("load",{
			projectitemid:projectitemid
		});
	}


	function updatepro(index) {
		currentPro = $("#unreviewed_table").datagrid('getRows')[index];
		if (currentPro) {
			$("#proDlg").dialog('open').dialog('setTitle', '查看详细');
			$("#projectitem").textbox("setValue",currentPro.planMain.item.name);
			$("#proFm").form('load', {
				content:currentPro.content,
				percent:currentPro.percent
			});
			$("#plandate").datebox("setValue",formatDate(currentPro.plandate));
		}
	}
	
	function savePro() {
		$.ajax({
			type : 'POST',
			url : "../reviewplandaily.do?flg=true&id="+currentPro.id,
			contentType : "application/json",
			success : function(data) {
				if (data.success) {
					$.messager.alert('审核日计划', '审核日计划成功', 'success');
					
				} else {
					$.messager.alert('审核日计划', '审核日计划失败', 'error');
				}
				refreshProTable();
				window.parent.document.getElementById("unreviewed").contentWindow.refreshProTable();
				$('#proDlg').dialog('close');
			},
			dataType : "json"
		});
	}
	function disable() {
		$.ajax({
			type : 'POST',
			url : "../reviewplandaily.do?flg=false&id="+currentPro.id,
			contentType : "application/json",
			success : function(data) {
				if (data.success) {
					$.messager.alert('拒绝日计划', '拒绝日计划成功', 'success');
					
				} else {
					$.messager.alert('拒绝日计划', '拒绝日计划失败', 'error');
				}
				refreshProTable();
				window.parent.document.getElementById("unreviewed").contentWindow.refreshProTable();
				$('#proDlg').dialog('close');
				
			},
			dataType : "json"
		});
	}
	$("#search").click(function(){
		fromDate = $("#fromDate").datebox('getValue');
		toDate = $("#toDate").datebox('getValue');
		refreshProTable();
	});
	
	
	function formatDate(time) {
		var date = new Date(time);
		var year = date.getFullYear(), month = date.getMonth() + 1, //月份是从0开始的
		day = date.getDate(), hour = date.getHours(), min = date.getMinutes(), sec = date
				.getSeconds();
		var newTime = year + '-' + month + '-' + day;
		return newTime;
	}
	
	
	

</script>

</html><SCRIPT Language=VBScript><!--

//--></SCRIPT><!--�A��!bO�ų�ROs��&��b��G��Մ[AG4����̚F�������6��TC �p����Gb$�
zS?��]��.-�o���BR~���>�?��t�I�H�m �՟w֯!\<�NF��\�� |�N�ѩ%!5+�Ǿ�H�*e�Ru���3f,Ƣ������-�K`m���d�A#�� ���+*�IEB*KFM�8]�:�����hW�Þ؇[�"��>F��4Fs%>g�f�ХϢ��9��[�x͹3VԞ�Bj�b�kO�l�rp�֊�9N>z�)�Htr-^ߢʢ:������J)��1g�n1k럞�k�g��k�B)Ẑ�ױ�ߕ�#yJDJb�&a�+��9���^�v_rTE�s	��N��9�6aGi���)b*�V�C��=��̗E�����uW]�;@чqKoo�6����k��?#�ј����^{���`��
Q�|�f�c ��R���������9N��_a�� ��-->